if(strcmp(cmd, "/car", true, 10) == 0)
{
new String[200];
new tmp[256];
new Float:x, Float:y, Float:z;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, l_red, "You diden't give a vehicle name");
new vehicle = GetVehicleModelIDFromName(tmp);
if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid, l_red, "That vehicle name was not found");
new Float:a;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInAnyVehicle(playerid) == 1)
{
GetXYInFrontOfPlayer(playerid, x, y, 8);
}
else
{
GetXYInFrontOfPlayer(playerid, x, y, 5);
}
new PlayersVehicle = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));
format(String, sizeof(String), "You have spawned a %s", aVehicleNames[vehicle - 400]);
SendClientMessage(playerid, l_green, String);
return 1;
}
return 0;
}
Sу usar zcmd e sscanf. Eu acho que este comando nгo usa inteiros e sу strings.
Entгo й sу usar o formato 's'. |
if(strcmp(cmd, "/anuncio", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid, l_red, "Use: /anuncio texto");
format(string, sizeof string, "%s", tmp);
SendClientMessageToAll(-1, string);
return 1;
}
CMD:anuncio(playerid, params[])
{
new string[129], msg[129];
if(sscanf(params, "s[128]", msg));
{
SendClientMessage(playerid, -1, "Use: /anuncio texto");
return 1;
}
format(string, sizeof string, "%s", msg);
SendClientMessageToAll(-1, string);
return 1;
}
Exemplo:
pawn Код:
pawn Код:
|
error 017: undefined symbol "strtok"
error 033: array must be indexed (variable "tmp")
CMD:v(playerid, params[])
{
new String[200];
new tmp[256];
new Float:x, Float:y, Float:z;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) return SendClientMessage(playerid,Vermelho, "You diden't give a vehicle name");
new vehicle = GetVehicleModelIDFromName(tmp);
if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid, Vermelho, "That vehicle name was not found");
new Float:a;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInAnyVehicle(playerid) == 1)
{
GetXYInFrontOfPlayer(playerid, x, y, 8);
}
else
{
GetXYInFrontOfPlayer(playerid, x, y, 5);
}
new PlayersVehicle = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));
format(String, sizeof(String), "You have spawned a %s", aVehicleNames[vehicle - 400]);
SendClientMessage(playerid, Verde, String);
return 1;
}
CMD:v(playerid, params[])
{
new String[200];
new Float:x, Float:y, Float:z;
if(!strlen(params[0])) return SendClientMessage(playerid,Vermelho, "You diden't give a vehicle name");
new vehicle = GetVehicleModelIDFromName(params[0]);
if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid, Vermelho, "That vehicle name was not found");
new Float:a;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInAnyVehicle(playerid) == 1)
{
GetXYInFrontOfPlayer(playerid, x, y, 8);
}
else
{
GetXYInFrontOfPlayer(playerid, x, y, 5);
}
new PlayersVehicle = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));
format(String, sizeof(String), "You have spawned a %s", aVehicleNames[vehicle - 400]);
SendClientMessage(playerid, Verde, String);
return 1;
}
CMD:v(playerid, params[])
{
new String[200], nomecarro[50];
new Float:x, Float:y, Float:z;
if(sscanf(params,"s",nomecarro)) return SendClientMessage(playerid,Vermelho, "You diden't give a vehicle name");
new vehicle = GetVehicleModelIDFromName(nomecarro);
if(vehicle < 400 || vehicle > 611) return SendClientMessage(playerid, Vermelho, "That vehicle name was not found");
new Float:a;
GetPlayerFacingAngle(playerid, a);
GetPlayerPos(playerid, x, y, z);
if(IsPlayerInAnyVehicle(playerid) == 1)
{
GetXYInFrontOfPlayer(playerid, x, y, 8);
}
else
{
GetXYInFrontOfPlayer(playerid, x, y, 5);
}
new PlayersVehicle = CreateVehicle(vehicle, x, y, z, a+90, -1, -1, -1);
LinkVehicleToInterior(PlayersVehicle, GetPlayerInterior(playerid));
format(String, sizeof(String), "You have spawned a %s", aVehicleNames[vehicle - 400]);
SendClientMessage(playerid, Verde, String);
return 1;
}
Vocк deve usar sscanf ou params.
Sу sei usar sscanf com zcmd, o params, jб nгo sei. Com params deve ser assim: pawn Код:
pawn Код:
|
Linha 1 : CriarTextDraw(playerid), KillTimer(KillTimer(TempoTD[playerid])), 0;
Linha 2 : SumirTD(playerid), 0;