02.08.2012, 03:30
(
Последний раз редактировалось [KHK]Khalid; 02.08.2012 в 04:13.
)
To disable commands just use the Dming variable. Example:
For many spawns you should use Random which generates a pseudo-random number. Example:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/SomeCommand", true))
{
if(Dming[playerid] == 1) // if in dm
return SendClientMessage(playerid, -1, "This command is disabled in dms!"); // return error
// Not in dm, do your command.
return 1;
}
return 0;
}
pawn Код:
new randSpawn = random(4); // 4 is the highest possible random number. So this is suposed to choose between 4 spawns ('numbers') randomally
// The above code will generate a random number of four numbers (Starting from 0 not 1)
switch(randSpawn)
{
case 0: // if randSpawn equals to 0 (First Spawn?)
{
// Your first spawn place code
}
case 1: // if randSpawn equals to 0 (Second Spawn?)
{
// Your second spawn place code
}
case 2: // if randSpawn equals to 0 (Third Spawn?)
{
// Your third spawn place code
}
case 3: // if randSpawn equals to 0 (Forth Spawn?)
{
// Your forth spawn place code
}
}