Would this work? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Would this work? (
/showthread.php?tid=331255)
Would this work? -
iLcke - 04.04.2012
Would something like this work?
pawn Код:
CMD:emst(playerid, params[])
{
tmp = strtok(cmd, idx);
if(strcmp(tmp, "1", true, strlen(tmp)) == 0)
{
for(new i=0;i<VCARS;i++)
{
if(ServerCars[i][FactionCar] == 1)
{
if(IsVehicleOccupied(i) == 0)
{
SetVehicleToRespawn(i);
EngineStatus[i] = 0;
if(strcmp(tmp, "2", true, strlen(tmp)) == 0)
{
for(new i=0;i<VCARS;i++)
{
if(ServerCars[i][FactionCar] == 2)
{
if(IsVehicleOccupied(i) == 0)
{
SetVehicleToRespawn(i);
EngineStatus[i] = 0;
return 1;
}
Re: Would this work? -
[HiC]TheKiller - 04.04.2012
Why are you using strtok =P? I'm not sure what you are doing exactly, but I'll give you a little example of what I think you're trying to do:
pawn Код:
CMD:emst(playerid, params[])
{
if((params[0] == '1' || params[0] == '2') && !params[1])
{
new value = strval(params);
for(new i=0;i<VCARS;i++)
{
if(ServerCars[i][FactionCar] == value && IsVehicleOccupied(i) == 0)
{
SetVehicleToRespawn(i);
EngineStatus[i] = 0;
}
}
}
return 1;
}
Re: Would this work? -
iLcke - 04.04.2012
New to ZCMD.