Help me with simple conversion please -
Kirchhoff - 21.05.2013
Hi I want to arrange the gamemode a friend created for me ! And I want to transform the strcmp to cmd:asd
Here is the command :
pawn Код:
//=============================================================================================================================================================
CMD:vcar(playerid, params[])
{
new sendername[MAX_PLAYER_NAME],string[256];
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pVip] < 1)
{
SendClientMessage(playerid, COLOR_GRAD1, ""#GAlbastru"[Suceava-RPG]: {ffffff}Ne pare rau, dar nu ai acces la aceasta comanda.");
return 1;
}
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "» Scrie: /veh [carid] [color1] [color2]");
return 1;
}
new car;
car = strval(tmp);
if(car < 400 || car > 611) { SendClientMessage(playerid, COLOR_GREY, ""#GAlbastru"[Suceava-RPG]: {ffffff}Ne pare rau, dar Vehiculele sunt intre 400 si 611."); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "» Scrie: /veh [carid] [color1] [color2]");
return 1;
}
new color1;
color1 = strval(tmp);
if(color1 < 0 || color1 > 200000000) { SendClientMessage(playerid, COLOR_GREY, ""#GAlbastru"[Suceava-RPG]: {ffffff}Ne pare rau, dar culorile sunt intre 0 si 126."); return 1; }
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "» Scrie: /veh [carid] [color1] [color2]");
return 1;
}
new color2;
color2 = strval(tmp);
if(color2 < 0 || color2 > 126) { SendClientMessage(playerid, COLOR_GREY, ""#GAlbastru"[Suceava-RPG]: {ffffff}Ne pare rau, dar culorile sunt intre 0 si 126."); return 1; }
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X,Y,Z);
new carid = CreateVehicle(car, X,Y,Z, 0.0, color1, color2, 60000);
CreatedCars[CreatedCar] = carid;
CreatedCar ++;
MasinaSpawnata[carid] = 1;
format(string, sizeof(string), "» Vehicul [%d] Spawnat.", carid);
SendClientMessage(playerid, COLOR_GREY, string);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, 256, ""#GAlbastru"[Suceava-RPG]: {ff6347} %s a spawnat %d [Vehicle].", sendername,car);
SendVIPMessage(0x9D9D4FFF, string);
}
return 1;
}
and the erros is that
pawn Код:
D:\samp03\gamemodes\GameFront.pwn(49810) : error 017: undefined symbol "tmp"
D:\samp03\gamemodes\GameFront.pwn(49816) : error 017: undefined symbol "tmp"
D:\samp03\gamemodes\GameFront.pwn(49818) : error 017: undefined symbol "tmp"
D:\samp03\gamemodes\GameFront.pwn(49818) : error 017: undefined symbol "cmdtext"
D:\samp03\gamemodes\GameFront.pwn(49819) : error 017: undefined symbol "tmp"
D:\samp03\gamemodes\GameFront.pwn(49825) : error 017: undefined symbol "tmp"
D:\samp03\gamemodes\GameFront.pwn(49827) : error 017: undefined symbol "tmp"
D:\samp03\gamemodes\GameFront.pwn(49833) : error 017: undefined symbol "tmp"
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
8 Errors.
line 49816 is : car = strval(tmp);
How can I fix that ?
Re: Help me with simple conversion please -
[HiC]TheKiller - 21.05.2013
Remove
pawn Код:
tmp = strtok(cmdtext, idx);
And change tmp to params.
Re: Help me with simple conversion please -
Kirchhoff - 21.05.2013
I changed It doesn't give any errors but it doesn't work in game either here is the modified command
pawn Код:
CMD:vcar(playerid, params[])
{
new sendername[MAX_PLAYER_NAME],string[256];
if(IsPlayerConnected(playerid))
{
if (PlayerInfo[playerid][pVip] >= 1)
{
SendClientMessage(playerid, COLOR_GRAD1, ""#GAlbastru"[Suceava-RPG]: {ffffff}Ne pare rau, dar nu ai acces la aceasta comanda.");
return 1;
}
if(!strval(params))
{
SendClientMessage(playerid, COLOR_GRAD2, "» Scrie: /veh [carid] [color1] [color2]");
return 1;
}
new car;
car = strval(params);
if(car < 400 || car > 611) { SendClientMessage(playerid, COLOR_GREY, ""#GAlbastru"[Suceava-RPG]: {ffffff}Ne pare rau, dar Vehiculele sunt intre 400 si 611."); return 1; }
if(!strval(params))
{
SendClientMessage(playerid, COLOR_GRAD2, "» Scrie: /veh [carid] [color1] [color2]");
return 1;
}
new color1;
color1 = strval(params);
if(color1 < 0 || color1 > 200000000) { SendClientMessage(playerid, COLOR_GREY, ""#GAlbastru"[Suceava-RPG]: {ffffff}Ne pare rau, dar culorile sunt intre 0 si 126."); return 1; }
if(!strval(params))
{
SendClientMessage(playerid, COLOR_GRAD2, "» Scrie: /vcar [carid] [color1] [color2]");
return 1;
}
new color2;
color2 = strval(params);
if(color2 < 0 || color2 > 126) { SendClientMessage(playerid, COLOR_GREY, ""#GAlbastru"[Suceava-RPG]: {ffffff}Ne pare rau, dar culorile sunt intre 0 si 126."); return 1; }
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid, X,Y,Z);
new carid = CreateVehicle(car, X,Y,Z, 0.0, color1, color2, 60000);
CreatedCars[CreatedCar] = carid;
CreatedCar ++;
MasinaSpawnata[carid] = 1;
format(string, sizeof(string), "» Vehicul [%d] Spawnat.", carid);
SendClientMessage(playerid, COLOR_GREY, string);
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, 256, ""#GAlbastru"[Suceava-RPG]: {ff6347} %s a spawnat %d [Vehicle].", sendername,car);
SendAdminMessage(0x9D9D4FFF, string);
}
return 1;
}
but in game if I tipe /vec 411 1 1 for example it gives me the text
pawn Код:
SendClientMessage(playerid, COLOR_GREY, ""#GAlbastru"[Suceava-RPG]: {ffffff}Ne pare rau, dar culorile sunt intre 0 si 126."); return 1; }
WHY?
Re: Help me with simple conversion please -
mahdi499 - 21.05.2013
ok Define this at top it's really helpful
pawn Код:
#define IsNull(%1) \
((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
And At the command change any if(!strval... to
Or you can get sscanf