Quote:
Originally Posted by Extreme Vehicle Spawner script
pawn Код:
if (strcmp("/spawn", cmdtext, true, 10) == 0) { new string[128], name[MAX_PLAYER_NAME]; GetPlayerName(playerid,name,MAX_PLAYER_NAME); format(string,sizeof string,"%s je napisao /spawn",name); SendClientMessageToAll(0x00FF0AFF,string); ShowMenuForPlayer(AutoProdaja,playerid); return 1; }
|
/spawn has 6 characters, not 10, and you could do it like this:
pawn Код:
if(strcmp("/spawn", cmdtext, true) == 0)
{
new
arr[48];
GetPlayerName(playerid, arr, MAX_PLAYER_NAME);
format(arr, sizeof(arr), "%s je napisao \"/spawn\"", arr);
SendClientMessageToAll(0x00FF0AFF, arr);
ShowMenuForPlayer(AutoProdaja, playerid);
return true;
}
And also this:
Quote:
Originally Posted by Extreme Vehicle Spawner script
pawn Код:
switch(row) { case 0: { new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X,Y,Z); CreateVehicle(411, X,Y,Z,0.0,1,1,300); } case 1: { new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X,Y,Z); CreateVehicle(415, X,Y,Z,0.0,1,1,300); } /* other switch/case code.. */ }
|
is a waste of variables and functions, you could just do it like this:
pawn Код:
new
Float:pos[3];
GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
switch(row)
{
case 0: CreateVehicle(411, pos[0] + 2.0, pos[1] + 2.0, pos[2], 0.0, 1, 1, 300);
case 1: CreateVehicle(415, pos[0] + 2.0, pos[1] + 2.0, pos[2], 0.0, 1, 1, 300);
/* other switch/case code.. */
}