SA-MP Forums Archive
What's the problem? - 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: What's the problem? (/showthread.php?tid=644017)



What's the problem? - reddoxx - 02.11.2017

The errors:
C:\Users\Lenovo\Downloads\SA-MP1\gamemodes\SanJoseRolePlay.pwn(22435) : error 001: expected token: "*then", but found ")"
C:\Users\Lenovo\Downloads\SA-MP1\gamemodes\SanJoseRolePlay.pwn(22435) : error 029: invalid expression, assumed zero

and there is the code:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
new szString[144];
if weaponid = 23);
ApplyPlayerAnimation(playerid, "COLT45", "COLT45_RELOAD", 4.0, 0, 0, 0, 0, 0, 1);
return 1;
}


i want a system when a player shoots the tazer, play a reload animation


Re: What's the problem? - Lucases - 02.11.2017

pawn Код:
public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
new szString[144];
if(weaponid == 23) ApplyPlayerAnimation(playerid, "COLT45", "COLT45_RELOAD", 4.0, 0, 0, 0, 0, 0, 1);
return 1;
}
Why did you create a new string for nothing?


Re: What's the problem? - Konstantinos - 02.11.2017

You cannot terminate an if statement with a semicolon.
You forgot to open a parentheses.
Equal sign for checking is double.

It would have to be either:
pawn Код:
if (weaponid == 23)
    ApplyPlayerAnimation(playerid, "COLT45", "COLT45_RELOAD", 4.0, 0, 0, 0, 0, 0, 1);
for 1 function call or a group (for more):
pawn Код:
if (weaponid == 23)
{
    ApplyPlayerAnimation(playerid, "COLT45", "COLT45_RELOAD", 4.0, 0, 0, 0, 0, 0, 1);
}



Re: What's the problem? - reddoxx - 02.11.2017

Ohh, thanks Konstantinos