if(!IsPlayerConnected(VarID)) return SendClientMessage(playerid, -1, "Syntax Error: Player Not Connected!");
|
Nope, now it says "Syntax Error: Player Not Connected!" in the server.
Help! //edit: btw this worked on my other server, but not here |
if (!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "SERVER: This player is not connected."); // "!" = false, "!IsPlayerConnected(targetid) = If player is not connected. "targetid" = the one you are using the command on.
COMMAND:es(playerid,params[])
{
new pid; //the player(id) defined
new message[128]; //the string for the main-message
new targetid[MAX_PLAYER_NAME];
if(sscanf(params, "us[32]", pid, message)) //detects the wrong parameters, and if wrong, shows the usage
{
return SendClientMessage(playerid, COLOR_GREY, "Kasutus: /es [id] [tekst]");//displays the usage, if parameters are wrong
}
if (!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "SERVER: This player is not connected."); // "!" = false, "!IsPlayerConnected(targetid) = If player is not connected. "targetid" = the one you are using the command on.
new pmsg[256]; //the message for player 1
new pname[MAX_PLAYER_NAME]; // the name of player 1
GetPlayerName(playerid,pname,sizeof(pname)); //get (receive the info) of the player's name
format(pmsg,sizeof(pmsg),"(( -> %s(ID: %d) Erasхnum: %s ))",pname,playerid,message); //this will receive the message from the player, with the first message-string
new pidmsg[256]; //the message for player 2
new pidname[MAX_PLAYER_NAME];
GetPlayerName(pid,pidname,sizeof(pidname)); //get (receive the info) of the player's name
format(pidmsg,sizeof(pidmsg),"(( <- Erasхnum %s(ID: %d): %s ))",pidname,pid,message); //this will let the player know, that he has sent successfully a message to his destination
SendClientMessage(pid, COLOR_ORANGE, pmsg); //the message for player 1 should appear in orange, the first message-string is used here
PlayerPlaySound(pid,1057,0.0,0.0,0.0); //play a "success-sound"
SendClientMessage(playerid, COLOR_ORANGE, pidmsg); //the message for player 2 should also appear in orange, the second message-string is used here
return 1;
}
COMMAND:es(playerid,params[])
{
new pid; //the player(id) defined
new message[128]; //the string for the main-message
if(sscanf(params, "us[32]", pid, message)) //detects the wrong parameters, and if wrong, shows the usage
{
return SendClientMessage(playerid, COLOR_GREY, "Kasutus: /es [id] [tekst]");//displays the usage, if parameters are wrong
}
if (!IsPlayerConnected(pid)) return SendClientMessage(playerid, COLOR_GREY, "SERVER: This player is not connected."); // "!" = false, "!IsPlayerConnected(pid) = If player is not connected. "pid" = the one you are using the command on.
new pmsg[256]; //the message for player 1
new pname[MAX_PLAYER_NAME]; // the name of player 1
GetPlayerName(playerid,pname,sizeof(pname)); //get (receive the info) of the player's name
format(pmsg,sizeof(pmsg),"(( -> %s(ID: %d) Erasхnum: %s ))",pname,playerid,message); //this will receive the message from the player, with the first message-string
new pidmsg[256]; //the message for player 2
new pidname[MAX_PLAYER_NAME];
GetPlayerName(pid,pidname,sizeof(pidname)); //get (receive the info) of the player's name
format(pidmsg,sizeof(pidmsg),"(( <- Erasхnum %s(ID: %d): %s ))",pidname,pid,message); //this will let the player know, that he has sent successfully a message to his destination
SendClientMessage(pid, COLOR_ORANGE, pmsg); //the message for player 1 should appear in orange, the first message-string is used here
PlayerPlaySound(pid,1057,0.0,0.0,0.0); //play a "success-sound"
SendClientMessage(playerid, COLOR_ORANGE, pidmsg); //the message for player 2 should also appear in orange, the second message-string is used here
return 1;
}
|
Wicked, i defined targetid as "[MAX_PLAYER_NAME]" and i get this:
"error 035: argument type mismatch (argument 1)" Here's the code: Код:
COMMAND:es(playerid,params[])
{
new pid; //the player(id) defined
new message[128]
new targetid;
if(sscanf(params, "us[32]", pid, message)) //detects the wrong parameters, and if wrong, shows the usage
{
return SendClientMessage(playerid, COLOR_GREY, "Kasutus: /es [id] [tekst]");//displays the usage, if parameters are wrong
}
if (!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "SERVER: This player is not connected."); // "!" = false, "!IsPlayerConnected(targetid) = If player is not connected. "targetid" = the one you are using the command on.
new pmsg[256]; //the message for player 1
new pname[MAX_PLAYER_NAME]; // the name of player 1
GetPlayerName(playerid,pname,sizeof(pname)); //get (receive the info) of the player's name
format(pmsg,sizeof(pmsg),"(( -> %s(ID: %d) Erasхnum: %s ))",pname,playerid,message); //this will receive the message from the player, with the first message-string
new pidmsg[256]; //the message for player 2
new pidname[MAX_PLAYER_NAME];
GetPlayerName(pid,pidname,sizeof(pidname)); //get (receive the info) of the player's name
format(pidmsg,sizeof(pidmsg),"(( <- Erasхnum %s(ID: %d): %s ))",pidname,pid,message); //this will let the player know, that he has sent successfully a message to his destination
SendClientMessage(pid, COLOR_ORANGE, pmsg); //the message for player 1 should appear in orange, the first message-string is used here
PlayerPlaySound(pid,1057,0.0,0.0,0.0); //play a "success-sound"
SendClientMessage(playerid, COLOR_ORANGE, pidmsg); //the message for player 2 should also appear in orange, the second message-string is used here
return 1;
}
|
COMMAND:es(playerid,params[])
{
new message[128], pid, targetid;
if(sscanf(params, "us[32]", pid, message)) //detects the wrong parameters, and if wrong, shows the usage
{
return SendClientMessage(playerid, COLOR_GREY, "Kasutus: /es [id] [tekst]");//displays the usage, if parameters are wrong
}
if (!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_GREY, "SERVER: This player is not connected."); // "!" = false, "!IsPlayerConnected(targetid) = If player is not connected. "targetid" = the one you are using the command on.
new pmsg[256]; //the message for player 1
new pname[MAX_PLAYER_NAME]; // the name of player 1
GetPlayerName(playerid,pname,sizeof(pname)); //get (receive the info) of the player's name
format(pmsg,sizeof(pmsg),"(( -> %s(ID: %d) Erasхnum: %s ))",pname,playerid,message); //this will receive the message from the player, with the first message-string
new pidmsg[256]; //the message for player 2
new pidname[MAX_PLAYER_NAME];
GetPlayerName(pid,pidname,sizeof(pidname)); //get (receive the info) of the player's name
format(pidmsg,sizeof(pidmsg),"(( <- Erasхnum %s(ID: %d): %s ))",pidname,pid,message); //this will let the player know, that he has sent successfully a message to his destination
SendClientMessage(pid, COLOR_ORANGE, pmsg); //the message for player 1 should appear in orange, the first message-string is used here
PlayerPlaySound(pid,1057,0.0,0.0,0.0); //play a "success-sound"
SendClientMessage(playerid, COLOR_ORANGE, pidmsg); //the message for player 2 should also appear in orange, the second message-string is used here
return 1;
}
|
Don't define the "targetid". I've changed the code for you.
pawn Код:
|