Vice City Multiplayer
VC:MP 0.3 => mIRC/pawn Scripting => Topic started by: Mansoor ali on April 18, 2012, 11:12:51 am
-
i made a cmd which cops can use but i have one error
if any cop use /c suspect he can suspect any criminal
i made one thing in this that cop can't suspect any other cop so i get 1 error plz help me :-\
i add this at the top of the script
[pawn]new Cop[MAX_PLAYERS];
new Criminal[MAX_PLAYERS];[/pawn]
i add this in onplayerspawn
[pawn] if(classid == 1 || classid == 2 || classid == 3 || classid == 4 || classid == 98 || classid == 100 || classid == 102 || classid == 103) {
SendClientMessage(playerid,COLOR_YELLOW,"*** You have spawned as a law enforcement person.");
Cop[playerid] = 1;
}
if(classid == 27 || classid == 29 || classid == 30 || classid == 46 || classid == 51 || classid == 87 || classid == 85 || classid == 149) {
SendClientMessage(playerid,COLOR_YELLOW,"*** You have spawned as a criminal.");
Criminal[playerid] = 1;
}[/pawn]
i add this in playerdisconnect
[pawn] Cop[playerid] = 0;
Criminal[playerid] = 0;[/pawn]
i add this in playerdeath
[pawn] Cop[playerid] = 0;
Criminal[playerid] = 0;[/pawn]
i add this ccmd at the down side of " drown " cmd
[pawn] else if(strcmp(cmd,"suspect",true) == 0 || strcmp(cmd,"sus",true) == 0) {
new szMsg[256], plr;
tmp = strtok(cmdtext, idx), plr = FindPlayerIDFromString(tmp);
if(Cop[playerid] == 1)
if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_RED, "You need to login first!");
else if (!strlen(tmp)) SendClientMessage(playerid,COLOR_RED,"USAGE: /c suspect [Nick/ID] or /c sus [Nick/ID]");
else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Unknown player");
else if (plr == classid == 1) SendClientMessage(playerid,COLOR_RED,"Error: He is not criminal");
{
TogglePlayerControllable(playerid,1);
SetPlayerPos(playerid, 387.0193,-510.2893,9.3956 );
SetTimer("playersuspect",9999,0);
}
return 1;
}[/pawn]
i add this at down side of the script:
[pawn]public playersuspect(playerid)
{
TogglePlayerControllable(playerid, 0 );
SetPlayerPos(playerid, 399.5581,-468.9074,11.7367);
SendClientMessage(playerid, COLOR_GREEN,"You are now un suspect");
SendClientMessage(playerid, COLOR_GREEN,"Now go and kill the cops");
}[/pawn]
i get this 1 error:
D:\MANSOOR FILES 8-)\Games\GTA Vice City\Vice City Mp\VC-MP SERVERS\Copy of VCMP SERVER\gamemodes\Untitled.pwn(1984) : error 017: undefined symbol "classid"
plz help me :-[
-
classid is just for OnPlayerSpawn and OnPlayerRequestClass.
So ... classid isn't defined for OnPlayerCommandText / OnPlayerText => you can't use the same "classid" for cmds.
And if you just want to check in cmd if the plr is criminal or not you can just replace this:
else if (plr == classid == 1) SendClientMessage(playerid,COLOR_RED,"Error: He is not criminal");
With this:
else if(Cop[plr] == 1 || Criminal[plr] == 0) SendClientMessage(playerid,COLOR_RED,"Error: He is not criminal");
And I saw another problem on cmd ...
if(Cop[playerid] == 1)
I don't used something like this and now i don't have time to test it.
I will give you your cmd with my adds:
else if(strcmp(cmd,"suspect",true) == 0 || strcmp(cmd,"sus",true) == 0) {
new szMsg[256], plr;
tmp = strtok(cmdtext, idx), plr = FindPlayerIDFromString(tmp);
if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_RED, "You need to login first!");
else if(Cop[playerid] == 0) SendClientMessage(playerid,COLOR_RED,"You need to be cop to can use this cmd !");
else if (!strlen(tmp)) SendClientMessage(playerid,COLOR_RED,"USAGE: /c suspect [Nick/ID] or /c sus [Nick/ID]");
else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Unknown player");
else if (Cop[plr] == 1 || Criminal[plr] == 0) SendClientMessage(playerid,COLOR_RED,"Error: He is not criminal");
{
TogglePlayerControllable(playerid,1);
SetPlayerPos(playerid, 387.0193,-510.2893,9.3956 );
SetTimer("playersuspect",9999,0);
}
return 1;
}
-
Thankx sseebbyy you are the best scripter! :o
-
[pawn]SetTimer("playersuspect",9999,0);[/pawn]
Won't work since you can't send parameters with SetTimer()
-
[pawn]SetTimer("playersuspect",9999,0);[/pawn]
Won't work since you can't send parameters with SetTimer()
Hey Aldo!
this is work fine with me. what is wrong with this? >:(
-
[pawn]SetTimer("playersuspect",9999,0);[/pawn]
Won't work since you can't send parameters with SetTimer()
Will work .
//SetTimer(timername,interval of time,true/false);
=> SetTimer("playersuspect",9999,0) => SetTimer("playerisuspect",9999,false)
1000 => 1 second
60000 => 1 minute
360000 => 1 hour
He made to be to 10 seconds.
-
[pawn]public playersuspect(playerid)[/pawn]
[pawn]SetTimer("playersuspect",9999,0);[/pawn]
The only reason it works is because the compiler sends no error/warning message.. It won't work in-game.. If it does, thats because your testing it on your own.. Test it when there are multiple player in-game..
-
You think its works cause, you test it with you id just the 0 id one, it will work, if you test it with other player, will select another wrong player.
Use: /c sus
}
Suspected[playerid] = 1;
}
and them use:
if(Supected[playerid] == 1 ..... {
-
[pawn]SetTimer("playersuspect",9999,0);[/pawn]
Won't work since you can't send parameters with SetTimer()
Will work .
//SetTimer(timername,interval of time,true/false);
=> SetTimer("playersuspect",9999,0) => SetTimer("playerisuspect",9999,false)
1000 => 1 second
60000 => 1 minute
360000 => 1 hour
He made to be to 10 seconds.
Yeah
-
Mansoor ali !
I made a mistake
3600000 => 1 hour
And now, Look and at the Fuzzy's post and Dilson's post.
I don't saw the "playerid"from public.
And i will say what Fuzzy and Dilson already told you !
You can't use "playerid" in a public made by you !
"playerid" is just for the player with ID 0 !
The only reason it works is because the compiler sends no error/warning message.. It won't work in-game.. If it does, thats because your testing it on your own.. Test it when there are multiple player in-game..
You think its works cause, you test it with you id just the 0 id one, it will work, if you test it with other player, will select another wrong player.
-
chack this which mistake in this: ::)
[pawn]new Cop[MAX_PLAYERS];
new Criminal[MAX_PLAYERS];[/pawn]
[pawn]public OnPlayerSpawn( playerid,classid,teamid )
{
if(classid == 1 || classid == 2 || classid == 3 || classid == 4 || classid == 98 || classid == 100 || classid == 102 || classid == 103) {
SendClientMessage(playerid,COLOR_YELLOW,"*** You have spawned as a law enforcement person.");
Cop[playerid] = 1;
}
if(classid == 27 || classid == 29 || classid == 30 || classid == 46 || classid == 51 || classid == 87 || classid == 85 || classid == 149) {
SendClientMessage(playerid,COLOR_YELLOW,"*** You have spawned as a criminal.");
Criminal[playerid] = 1;
}[/pawn]
[pawn]//------------------------------------------------------------------------------
else if(strcmp(cmd,"suspect",true) == 0 || strcmp(cmd,"sus",true) == 0) {
new szMsg[256], plr;
tmp = strtok(cmdtext, idx), plr = FindPlayerIDFromString(tmp);
if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_RED, "You need to login first!");
else if (GetPlayerDistance(plr) == 0.50 || GetPlayerDistance(plr) == 1.0 || GetPlayerDistance(plr) == 1.5 || GetPlayerDistance(plr) == 2.0 || GetPlayerDistance(plr) == 2.5 || GetPlayerDistance(plr) == 3.0 || GetPlayerDistance(plr) == 3.5 || GetPlayerDistance(plr) == 4.0 || GetPlayerDistance(plr) == 4.5 ||GetPlayerDistance(plr) == 5) SendClientMessage(playerid, COLOR_RED, "You are too far!");
else if(Cop[playerid] == 0) SendClientMessage(playerid,COLOR_RED,"You need to be cop to can use this cmd !");
else if (!strlen(tmp)) SendClientMessage(playerid,COLOR_RED,"USAGE: /c suspect [Nick/ID] or /c sus [Nick/ID]");
else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Unknown player");
else if (Cop[plr] == 1 || Criminal[plr] == 0) SendClientMessage(playerid,COLOR_RED,"Error: He is not criminal!");
else
{
GameTextForPlayerBottom(plr, "Suspected!");
SendClientMessage(plr, COLOR_RED, "You are Suspected by Cop!");
TogglePlayerControllable(plr,0);
SetPlayerPos(plr, 387.0193,-510.2893,9.3956 );
SetTimer("CriminalSuspect",60000,0);
}
return 1;
}
//------------------------------------------------------------------------------
else if(strcmp(cmd,"killcrim",true) == 0 || strcmp(cmd,"killc",true) == 0) {
new szMsg[256], plr;
tmp = strtok(cmdtext, idx), plr = FindPlayerIDFromString(tmp);
if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_RED, "You need to login first!");
else if (GetPlayerDistance(plr) == 0.50 || GetPlayerDistance(plr) == 1.0 || GetPlayerDistance(plr) == 1.5 || GetPlayerDistance(plr) == 2.0 || GetPlayerDistance(plr) == 2.5 || GetPlayerDistance(plr) == 3.0 || GetPlayerDistance(plr) == 3.5 || GetPlayerDistance(plr) == 4.0 || GetPlayerDistance(plr) == 4.5 ||GetPlayerDistance(plr) == 5) SendClientMessage(playerid, COLOR_RED, "You are too far!");
else if(Cop[playerid] == 0) SendClientMessage(playerid,COLOR_RED,"You need to be cop to can use this cmd !");
else if (!strlen(tmp)) SendClientMessage(playerid,COLOR_RED,"USAGE: /c killcrim [Nick/ID] or /c killc [Nick/ID]");
else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Unknown player");
else if (Cop[plr] == 1 || Criminal[plr] == 0) SendClientMessage(playerid,COLOR_RED,"Error: He is not criminal!");
else
{
SetPlayerHealth( plr, 0.0 );
GameTextForPlayerBottom(plr, "Killed!");
SendClientMessage(plr, COLOR_RED, "You are killed by Cop!");
}
return 1;
}
//------------------------------------------------------------------------------
else if(strcmp(cmd,"kidnap",true) == 0 || strcmp(cmd,"kid",true) == 0) {
new szMsg[256], plr;
tmp = strtok(cmdtext, idx), plr = FindPlayerIDFromString(tmp);
if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_RED, "You need to login first!");
else if (GetPlayerDistance(plr) == 0.50 || GetPlayerDistance(plr) == 1.0 || GetPlayerDistance(plr) == 1.5 || GetPlayerDistance(plr) == 2.0 || GetPlayerDistance(plr) == 2.5 || GetPlayerDistance(plr) == 3.0 || GetPlayerDistance(plr) == 3.5 || GetPlayerDistance(plr) == 4.0 || GetPlayerDistance(plr) == 4.5 ||GetPlayerDistance(plr) == 5) SendClientMessage(playerid, COLOR_RED, "You are too far!");
else if(Cop[playerid] == 0) SendClientMessage(playerid,COLOR_RED,"You need to be criminal to can use this cmd !");
else if (!strlen(tmp)) SendClientMessage(playerid,COLOR_RED,"USAGE: /c kidnap [Nick/ID] or /c kid [Nick/ID]");
else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Unknown player");
else if (Criminal[plr] == 1 || Cop[plr] == 0) SendClientMessage(playerid,COLOR_RED,"Error: He is not cop!");
else
{
GameTextForPlayerBottom(plr, "Kidnapped!");
SendClientMessage(plr, COLOR_RED, "You are kidnapped by Criminal!");
SetPlayerPos(plr, -961.8445,149.3515,9.3955);
SetPlayerAnimation(plr, 33 );
TogglePlayerControllable(playerid, 0);
SetTimer("CopKidnap",60000,0);
}
return 1;
}
//------------------------------------------------------------------------------
else if(strcmp(cmd,"killcop",true) == 0 || strcmp(cmd,"killcp",true) == 0) {
new szMsg[256], plr;
tmp = strtok(cmdtext, idx), plr = FindPlayerIDFromString(tmp);
if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_RED, "You need to login first!");
else if (GetPlayerDistance(plr) == 0.50 || GetPlayerDistance(plr) == 1.0 || GetPlayerDistance(plr) == 1.5 || GetPlayerDistance(plr) == 2.0 || GetPlayerDistance(plr) == 2.5 || GetPlayerDistance(plr) == 3.0 || GetPlayerDistance(plr) == 3.5 || GetPlayerDistance(plr) == 4.0 || GetPlayerDistance(plr) == 4.5 ||GetPlayerDistance(plr) == 5) SendClientMessage(playerid, COLOR_RED, "You are too far!");
else if(Cop[playerid] == 0) SendClientMessage(playerid,COLOR_RED,"You need to be criminal to can use this cmd !");
else if (!strlen(tmp)) SendClientMessage(playerid,COLOR_RED,"USAGE: /c killcop [Nick/ID] or /c killcp [Nick/ID]");
else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_RED,"Error: Unknown player");
else if (Criminal[plr] == 1 || Cop[plr] == 0) SendClientMessage(playerid,COLOR_RED,"Error: He is not cop!");
else
{
SetPlayerHealth( plr, 0.0 );
GameTextForPlayerBottom(plr, "Killed!");
SendClientMessage(plr, COLOR_RED, "You are killed by Criminal!");
}
return 1;
}
//------------------------------------------------------------------------------[/pawn]
[pawn]//==============================================================================
public CriminalSuspect(plr)
{
TogglePlayerControllable(plr, 1 );
SetPlayerPos(plr, 399.5581,-468.9074,11.7367 );
SendClientMessage(plr, COLOR_GREEN,"You are now un suspect!");
SendClientMessage(plr, COLOR_GREEN,"Now go and kill the cops!");
}
//==============================================================================
public CopKidnap(plr)
{
TogglePlayerControllable(plr, 1 );
SetPlayerPos(plr, 399.5581,-468.9074,11.7367 );
SendClientMessage(plr, COLOR_GREEN,"You are now un kidnap!");
SendClientMessage(plr, COLOR_GREEN,"Now go and kill the criminals!");
}
//==============================================================================[/pawn]
::)
if any mistake plz tell me :D
-
if(classid == 27 || classid == 29 || classid == 30 || classid == 46 || classid == 51 || classid == 87 || classid == 85 || classid == 149) {
SendClientMessage(playerid,COLOR_YELLOW,"*** You have spawned as a criminal.");
Criminal[playerid] = 1;
}[/pawn]
i have this problem it is not working :(
-
new Criminal[MAX_PLAYERS];
You might wanna use enum..
-
new Criminal[MAX_PLAYERS];
You might wanna use enum..
make for me plz
-
[pawn]SetTimer("playersuspect",9999,0);[/pawn]
Won't work since you can't send parameters with SetTimer()
Hey Aldo!
this is work fine with me. what is wrong with this? >:(
It works for you because you are playing as id 0
[pawn]SetTimer("playersuspect",9999,0);[/pawn]
Won't work since you can't send parameters with SetTimer()
Will work .
//SetTimer(timername,interval of time,true/false);
=> SetTimer("playersuspect",9999,0) => SetTimer("playerisuspect",9999,false)
1000 => 1 second
60000 => 1 minute
360000 => 1 hour
He made to be to 10 seconds.
Yes the timer will run but it wont work as it is suppose to with more then 1 player it will just set the variables for playerid 0