SA-MP Forums Archive
Small help - 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: Small help (/showthread.php?tid=581234)



Small help - ALoX12 - 11.07.2015

PHP код:
public OnPlayerUpdate(playerid)
{
    if(
pData[playerid][pDonator] == 0//If their VIP level is greater than 0 (AKA They are a VIP)
    
{
        
SetPlayerSkillLevel(playeridWEAPONSKILL_SAWNOFF_SHOTGUN999);
        
SetPlayerSkillLevel(playeridWEAPONSKILL_PISTOL999);
    }
    else
    {
        
SetPlayerSkillLevel(playeridWEAPONSKILL_PISTOL0);
        
SetPlayerSkillLevel(playeridWEAPONSKILL_SAWNOFF_SHOTGUN0);
    } 
Any idea why this is not working? I m trying to set who is non-donator gets 1 sawnf and who is donator gets 2 sawnf.
it was working fine before idk what's wrong now. Do you see something wrong here?


Re: Small help - HydraHumza - 11.07.2015

Quote:
Originally Posted by ALoX12
Посмотреть сообщение
PHP код:
public OnPlayerUpdate(playerid)
{
    if(
pData[playerid][pDonator] == 0//If their VIP level is greater than 0 (AKA They are a VIP)
    
{
        
SetPlayerSkillLevel(playeridWEAPONSKILL_SAWNOFF_SHOTGUN999);
        
SetPlayerSkillLevel(playeridWEAPONSKILL_PISTOL999);
    }
    else
    {
        
SetPlayerSkillLevel(playeridWEAPONSKILL_PISTOL0);
        
SetPlayerSkillLevel(playeridWEAPONSKILL_SAWNOFF_SHOTGUN0);
    } 
Any idea why this is not working? I m trying to set who is non-donator gets 1 sawnf and who is donator gets 2 sawnf.
it was working fine before idk what's wrong now. Do you see something wrong here?
PHP код:
public OnPlayerUpdate(playerid)
{
    if(
pData[playerid][pDonator] == 0//If their VIP level is greater than 0 (AKA They are a VIP)
    
{
       
SetPlayerSkillLevel(playeridWEAPONSKILL_PISTOL0);
        
SetPlayerSkillLevel(playeridWEAPONSKILL_SAWNOFF_SHOTGUN0);
    }
    else
    {
        
SetPlayerSkillLevel(playeridWEAPONSKILL_SAWNOFF_SHOTGUN999);
        
SetPlayerSkillLevel(playeridWEAPONSKILL_PISTOL999);
    } 



Re: Small help - kalanerik99 - 11.07.2015

You made mistake

Код:
if(pData[playerid][pDonator] == 0) //If their VIP level is greater than 0 (AKA They are a VIP) 
   {
to

Код:
    if(pData[playerid][pDonator] >= 1) //If their VIP level is greater than 0 (AKA They are a VIP) 
    {
EDIT: DIDN'T SEE PREVIOUS POST


Re : Small help - KillerDVX - 12.07.2015

As you can see, you made a mistake. You said that the player's VIP level should be greater than 0 ?

So why would you use "==" ? Because the operator means that Left is equal to Right.

Replace this code :

PHP код:
if(pData[playerid][pDonator] == 0//If their VIP level is greater than 0 (AKA They are a VIP) 
    

        
SetPlayerSkillLevel(playeridWEAPONSKILL_SAWNOFF_SHOTGUN999); 
        
SetPlayerSkillLevel(playeridWEAPONSKILL_PISTOL999); 
    } 
By this one :

PHP код:
if(pData[playerid][pDonator] > 0//If their VIP level is greater than 0 (AKA They are a VIP) 
    

        
SetPlayerSkillLevel(playeridWEAPONSKILL_SAWNOFF_SHOTGUN999); 
        
SetPlayerSkillLevel(playeridWEAPONSKILL_PISTOL999); 
    } 



Re: Small help - liquor - 12.07.2015

You really shouldn't use OnPlayerUpdate for that... and almost nothing else that you could think of.
It is absolutely unnecessary to set the players skill about 30 times per second, as you only need to do it once during the players entire session.