07.04.2008, 05:22
Quote:
Originally Posted by Saorp
Код:
//--------------------[BlindFold]------------------------------------------------------------------------ if(strcmp(cmd, "/blindfold", true) == 0) { if(IsPlayerConnected(playerid)) tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD1, "USAGE: //blindfold [player name]"); return 1; } SetPlayerCameraPos(playerid, -833.5241,-1358.8575,86.9054); SetPlayerCameraLookAt(playerid, -830.8118,-1360.3612,87.0289); return 1; } if(strcmp(cmd, "/unblindfold", true) == 0) { if(IsPlayerConnected(playerid)) tmp = strtok(cmdtext, idx); if(!strlen(tmp)) { SendClientMessage(playerid, COLOR_GRAD1, "USAGE: //unblindfold [player name]"); return 1; } SetCameraBehindPlayer(playerid); return 1; } |
Try this:
[pawn]
// Using
pawn Код:
tags!
if(strcmp(cmd, "/blindfold", true) == 0) // '/blindfold'
{
tmp = strtok(cmdtext, idx); // Making 'tmp' hold the id. Remains as a string.
if(!strlen(tmp)) // If the length of 'tmp' is 0:
return SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /blindfold [player id]"); // Send the message AND end the command here (thus avoiding the 'SERVER: Unknown command.' message).
new id = strval(tmp); // New integer which holds the value of 'tmp'. EG: /blindfold 6. 'id' would become 6.
if(IsPlayerConnected(id)) // If the id is connected:
{ // We are using more than a single statement, so we use braces.
SetPlayerCameraPos(id, -833.5241,-1358.8575,86.9054); // Setting the camera position for 'id'.
return SetPlayerCameraLookAt(id, -830.8118,-1360.3612,87.0289); // Setting the camera to look at X for 'id' AND end the command here (thus avoiding the 'SERVER: Unknown command.' message).
} // Closing brace for the id check.
}
if(strcmp(cmd, "/unblindfold", true) == 0) // '/unblindfold'
{
tmp = strtok(cmdtext, idx); // Making 'tmp' hold the id. Remains as a string.
if(!strlen(tmp)) // If the length of 'tmp' is 0:
return SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /unblindfold [player id]"); // Send the message AND end the command here (thus avoiding the 'SERVER: Unknown command.' message).
new id = strval(tmp); // New integer which holds the value of 'tmp'. EG: /blindfold 6. 'id' would become 6.
if(IsPlayerConnected(id)) // If the id is connected:
return SetCameraBehindPlayer(id); // Set the camera of 'id' behind them, as well as ending the command.
return 1; // If the id was not connected, add an else statement here. This will just stop the 'SERVER: Unknown command.' message.
}
pawn Код:
new id = GetPlayerID(tmp);
~Cueball~