How to return?
#1

hi,

sorry for my frequent posting, but I have got a problem wich is still not solved...

People told me that the problems I had in my server were because I didn't return in the right way...
I've searched the WIKI, and this forum for a tutorial on how to return but I couldn't find anything...
So if someone please can explain how to return :/


Example:
Код:
if(newstate == PLAYER_STATE_DRIVER)
	{
	    if(GetPlayerVehicleID(playerid) == 516)
        {
		    if(gTeam[playerid] != TEAM_DRIVERS)
		    {
				SendClientMessage(playerid,COLOR_ERROR,"Only Drivers can use this vehicle");
				RemovePlayerFromVehicle(playerid);
		        return 1;
			}
			GameTextForPlayer(playerid, "~w~ U entered A~y~ Lvl 3~w~ vehicle. Please drive to the ~r~ Red marker~w~, located in front of the club.", 3000, 4);
	 	            			startworkpickup = CreatePickup(1317, 14, 670.15740966797,-12752222900391,13467164993286, -1); //also, when a player enters this pickup, (if pickupid= blahblah, and then my code, it doesn't work either... but that's not in this callback
			return 1;
		}
	}

//Some other code
This is written under OnPlayerStateChange
And it does not work at all...

Please help me, and not just by correcting the script, but by explaining why and how :/
Sorry if that sounds quiet rude
Reply
#2

pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
    {
        if(GetPlayerVehicleID(playerid) == 516)
        {
            if(gTeam[playerid] == TEAM_DRIVERS)
            {
                GameTextForPlayer(playerid, "~w~ U entered A~y~ Lvl 3~w~ vehicle. Please drive to the ~r~ Red marker~w~, located in front of the club.", 3000, 4);
                startworkpickup = CreatePickup(1317, 14, 670.15740966797,-12752222900391,13467164993286, -1); //also, when a player enters this pickup, (if pickupid= blahblah, and then my code, it doesn't work either... but that's not in this callback
            }
            else
            {
                SendClientMessage(playerid,COLOR_ERROR,"Only Drivers can use this vehicle");
                RemovePlayerFromVehicle(playerid);
            }
        }
    }
Reply
#3

Nope, I can still enter as a team member of TEAM_COPS
and TEAM_UNSPAWNED
Reply
#4

Than you didnt define Teams good...

pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
    {
        if(GetPlayerVehicleID(playerid) == 516)
        {
            if(gTeam[playerid] == TEAM_DRIVERS)
            {
                GameTextForPlayer(playerid, "~w~ U entered A~y~ Lvl 3~w~ vehicle. Please drive to the ~r~ Red marker~w~, located in front of the club.", 3000, 4);
                startworkpickup = CreatePickup(1317, 14, 670.15740966797,-12752222900391,13467164993286, -1); //also, when a player enters this pickup, (if pickupid= blahblah, and then my code, it doesn't work either... but that's not in this callback
            }
            else if(gTeam[playerid] == TEAM_UNSPAWNED || gTeam[playerid] == TEAM_COPS)
            {
                SendClientMessage(playerid,COLOR_ERROR,"Only Drivers can use this vehicle");
                RemovePlayerFromVehicle(playerid);
            }
        }
    }
Reply
#5

GetVehicleModel(GetPlayerVehicleID(playerid)) == 516 ?
Reply
#6

Too Dragon:

Still doesn't work...

here's my team set code:

Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerPos(playerid,0,0,10);
    IsSpawned[playerid] =1;
    gTeam[playerid] = TEAM_UNSPAWNED;
	return 1;
}
when I spawn I immediately check if it works

if it doesn't work I type this cmd:
Код:
if (strcmp("/c", cmdtext, true, 10) == 0)
	{
	    //gTeam[playerid] = 0;
		gTeam[playerid] = TEAM_COPS;
		return 1;
	}
	
	if (strcmp("/u", cmdtext, true, 10) == 0)
	{
	    //gTeam[playerid] = 0;
		gTeam[playerid] = TEAM_UNSPAWNED;
		return 1;
	}
NOTE: I did not post entire code, but the commands work, that's for sure!
I just choose one of them

When i type the command, I'm sure that I changed to the team, because I checked that, but when I try to enter the Nebula (as COP or UNSPAWNED) I can enter it...

Last piece of code:

Код:
#define TEAM_COPS 1
#define TEAM_DRIVERS 2
#define TEAM_BANDIT 3
#define TEAM_UNSPAWNED 4
___

Too jefff, what do you mean?
Reply
#7

Jefff means are you sure the vehicle ID you enter is 516. Wondering that too, because the code seems fine.
Reply
#8

Do you have command gotocar or getincar? If you have teleport yourself to carID 516
Because you define vehicle ID;516 not model of vehicle 516..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)