SA-MP Forums Archive
If statement condition not taking (playerid). - 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: If statement condition not taking (playerid). (/showthread.php?tid=612882)



If statement condition not taking (playerid). - Maheerali - 22.07.2016

PHP код:
new bool:Instafix[MAX_PLAYERS];
if (
Instafix(playerid))
{
 
RepairVehicle(GetPlayerVehicleID(playerid));
}
    return 
1;
}
D:\SampSever\iPLEOMAX's TextDraw Editor\SAMP 0.3e Server\gamemodes\Untitled.pwn(219) : error 001: expected token: ";", but found ")"
D:\SampSever\iPLEOMAX'
s TextDraw Editor\SAMP 0.3e Server\gamemodes\Untitled.pwn(219) : error 029invalid expressionassumed zero 
I am using pwano


Re: If statement condition not taking (playerid). - Sjn - 22.07.2016

When you create a player array, you cannot use () to wrap the playerid.

You need to do
Код:
if (Instafix[playerid] == true/false)
Also, you must assign true or false before checking for either one of it's state.

Quote:
Originally Posted by Maheerali
Посмотреть сообщение
I am using pwano
Obviously...


Re: If statement condition not taking (playerid). - K0P - 22.07.2016

Quote:
Originally Posted by Sjn
Посмотреть сообщение
When you create a player array, you cannot use () to wrap the playerid.

You need to do
Код:
if (Instafix[playerid] == true/false)
Also, you must assign true or false before checking for either one of it's state.
Pawn will detect "if(Instafix[playerid])" as true
And "if(!Instafix[playerid])" as false

No need to add extra info there.

Quote:
Originally Posted by Sjn
Посмотреть сообщение
Obviously...
Nop,he can use other editors too.

Код:
if (Instafix[playerid]) 
{ 
     RepairVehicle(GetPlayerVehicleID(playerid)); 
     return 1; 
}



Re: If statement condition not taking (playerid). - Maheerali - 22.07.2016

D:\SampSever\iPLEOMAX's TextDraw Editor\SAMP 0.3e Server\gamemodes\Untitled.pwn(159) : error 001: expected token: ";", but found "]"


Re: If statement condition not taking (playerid). - K0P - 22.07.2016

Quote:
Originally Posted by Maheerali
Посмотреть сообщение
D:\SampSever\iPLEOMAX's TextDraw Editor\SAMP 0.3e Server\gamemodes\Untitled.pwn(159) : error 001: expected token: ";", but found "]"
Show some previous lines


Re: If statement condition not taking (playerid). - Maheerali - 22.07.2016

Quote:
Originally Posted by K0P
Посмотреть сообщение
Pawn will detect "if(Instafix[playerid])" as true
And "if(!Instafix[playerid])" as false

No need to add extra info there.


Nop,he can use other editors too.

Код:
if (Instafix[playerid]) 
{ 
     RepairVehicle(GetPlayerVehicleID(playerid)); 
     return 1; 
}
D:\SampSever\iPLEOMAX's TextDraw Editor\SAMP 0.3e Server\gamemodes\Untitled.pwn(159) : error 001: expected token: ";", but found "]"


Re: If statement condition not taking (playerid). - Maheerali - 22.07.2016

CMD:armor(playerid, params[])
{
SetPlayerArmour(playerid, 100.00);
return 1;
}
CMD:fix(playerid, params[])
{
if (Instafix[playerid] == true)
{
RepairVehicle(GetPlayerVehicleID(playerid));
}
return 1;
}


Re: If statement condition not taking (playerid). - K0P - 22.07.2016

Код:
CMD:armor(playerid, params[])
{
SetPlayerArmour(playerid, 100.00);
return 1;
}
CMD:fix(playerid, params[])
{
if (Instafix[playerid] == true)
{
    RepairVehicle(GetPlayerVehicleID(playerid));
    return 1;
}



Re: If statement condition not taking (playerid). - Maheerali - 22.07.2016

Quote:
Originally Posted by K0P
Посмотреть сообщение
Код:
CMD:armor(playerid, params[])
{
SetPlayerArmour(playerid, 100.00);
return 1;
}
CMD:fix(playerid, params[])
{
if (Instafix[playerid] == true)
{
    RepairVehicle(GetPlayerVehicleID(playerid));
    return 1;
}
Still Error please help


Re: If statement condition not taking (playerid). - SyS - 22.07.2016

brace is missing @ the end of 2nd cmd