[Help]: Derby Event System
#1

Hello!

I am trying to make my event system, but when an admin type /derby, then he is teleported to derby arena, but it's blank...

Code:

PHP код:
CMD:derby(playeridparams[])
{
    if(
gPlayerInfo[playerid][PLAYER_LEVEL] < 1) return SendClientMessage(playeridCOLOR_RED"You are Not Allowed To Use This Command!");
    if(
gPlayerInfo[playerid][PLAYER_JAILED] == 1)return SendClientMessage(playeridCOLOR_RED"ERROR: You Cannot Use Any Command When You're Jailed!");
    if(
sscanf(params"s"params)) return SendClientMessage(playeridCOLOR_ORANGE"Usage: /derby [monsters/sandkings/bangers]");
    if(!
strcmp(params"monsters"true))
    {
    new 
monsters;
    
SetPlayerPos(playerid, -1372.7242,930.6412,1041.5313);
    
SetPlayerInterior(playerid7);
    
monsters CreateVehicle(444,-1478.7618,943.6302,1041.3199,66.6085,0,196,124);
    
monsters CreateVehicle(444,-1469.9274,939.5936,1041.3219,73.5877,0,196,124);
    
monsters CreateVehicle(444,-1461.8712,936.9880,1041.3203,75.5558,0,196,124);
    
monsters CreateVehicle(444,-1452.4550,934.3753,1041.3235,80.0687,0,196,124);
    
monsters CreateVehicle(444,-1442.4575,932.4373,1041.3236,82.2893,0,196,124);
    
monsters CreateVehicle(444,-1432.0989,931.2426,1041.3236,87.0216,0,196,124);
    
monsters CreateVehicle(444,-1423.1830,931.0004,1041.3236,89.1793,0,196,124);
    
monsters CreateVehicle(444,-1412.1241,930.9387,1041.3237,88.6588,0,196,124);
    
monsters CreateVehicle(444,-1401.5637,930.6543,1041.3237,89.9734,0,196,124);
    
monsters CreateVehicle(444,-1388.2822,930.6476,1041.3239,89.9733,0,196,124);
    
LinkVehicleToInterior(monsters7);
    
GameTextForAll("~w~Derby event with ~g~MONSTERS ~w~is loading...",3000,3);
    }
    else if(!
strcmp(params"sandkings"true))
    {
    new 
sandkings;
       
SetPlayerPos(playerid, -1372.7242,930.6412,1041.5313);
       
SetPlayerInterior(playerid7);
    
sandkings CreateVehicle(495,-1478.7618,943.6302,1041.3199,66.6085,0,196,124);
    
sandkings CreateVehicle(495,-1469.9274,939.5936,1041.3219,73.5877,0,196,124);
    
sandkings CreateVehicle(495,-1461.8712,936.9880,1041.3203,75.5558,0,196,124);
    
sandkings CreateVehicle(495,-1452.4550,934.3753,1041.3235,80.0687,0,196,124);
    
sandkings CreateVehicle(495,-1442.4575,932.4373,1041.3236,82.2893,0,196,124);
    
sandkings CreateVehicle(495,-1432.0989,931.2426,1041.3236,87.0216,0,196,124);
    
sandkings CreateVehicle(495,-1423.1830,931.0004,1041.3236,89.1793,0,196,124);
    
sandkings CreateVehicle(495,-1412.1241,930.9387,1041.3237,88.6588,0,196,124);
    
sandkings CreateVehicle(495,-1401.5637,930.6543,1041.3237,89.9734,0,196,124);
    
sandkings CreateVehicle(495,-1388.2822,930.6476,1041.3239,89.9733,0,196,124);
    
LinkVehicleToInterior(sandkings7);
    
GameTextForAll("~w~Derby event with ~g~SANDKINGS ~w~is loading...",3000,3);
    }
    else if(!
strcmp(params"bangers"true))
    {
    new 
bangers;
       
SetPlayerPos(playerid, -1372.7242,930.6412,1041.5313);
       
SetPlayerInterior(playerid7);
    
bangers CreateVehicle(504,-1478.7618,943.6302,1041.3199,66.6085,0,196,124);
    
bangers CreateVehicle(504,-1469.9274,939.5936,1041.3219,73.5877,0,196,124);
    
bangers CreateVehicle(504,-1461.8712,936.9880,1041.3203,75.5558,0,196,124);
    
bangers CreateVehicle(504,-1452.4550,934.3753,1041.3235,80.0687,0,196,124);
    
bangers CreateVehicle(504,-1442.4575,932.4373,1041.3236,82.2893,0,196,124);
    
bangers CreateVehicle(504,-1432.0989,931.2426,1041.3236,87.0216,0,196,124);
    
bangers CreateVehicle(504,-1423.1830,931.0004,1041.3236,89.1793,0,196,124);
    
bangers CreateVehicle(504,-1412.1241,930.9387,1041.3237,88.6588,0,196,124);
    
bangers CreateVehicle(504,-1401.5637,930.6543,1041.3237,89.9734,0,196,124);
    
bangers CreateVehicle(504,-1388.2822,930.6476,1041.3239,89.9733,0,196,124);
    
LinkVehicleToInterior(bangers7);
    
GameTextForAll("~w~Derby event with ~g~BANGERS ~w~is loading...",3000,3);
    }
    return 
1;

Thanks for your help
Reply
#2

Bump
Reply
#3

Set the interior FIRST & then the position.
That is,
pawn Код:
SetPlayerInterior(...);
SetPlayerPos(..);
Reply
#4

Quote:
Originally Posted by Rajat_Pawar
Посмотреть сообщение
Set the interior FIRST & then the position.
That is,
pawn Код:
SetPlayerInterior(...);
SetPlayerPos(..);
It's steal the same.
Reply
#5

pawn Код:
new monsters[10];
    monsters[0] = CreateVehicle(444,-1478.7618,943.6302,1041.3199,66.6085,0,196,124);
    monsters[1] = CreateVehicle(444,-1469.9274,939.5936,1041.3219,73.5877,0,196,124);
    monsters[2] = CreateVehicle(444,-1461.8712,936.9880,1041.3203,75.5558,0,196,124);
    monsters[3] = CreateVehicle(444,-1452.4550,934.3753,1041.3235,80.0687,0,196,124);
    monsters[4] = CreateVehicle(444,-1442.4575,932.4373,1041.3236,82.2893,0,196,124);
    monsters[5] = CreateVehicle(444,-1432.0989,931.2426,1041.3236,87.0216,0,196,124);
    monsters[6] = CreateVehicle(444,-1423.1830,931.0004,1041.3236,89.1793,0,196,124);
    monsters[7] = CreateVehicle(444,-1412.1241,930.9387,1041.3237,88.6588,0,196,124);
    monsters[8] = CreateVehicle(444,-1401.5637,930.6543,1041.3237,89.9734,0,196,124);
    monsters[9] = CreateVehicle(444,-1388.2822,930.6476,1041.3239,89.9733,0,196,124);
for(new i=0;i <= monsters;i++)
{
    LinkVehicleToInterior(monsters[i], 7);
}
Reply
#6

Oh, gee. Sorry, I didn't even glance at the code plus misinterpreted the question. What you are doing, is just assigning the LAST vehicle created to the interior. The array above should work.
Reply
#7

Quote:
Originally Posted by zxc1
Посмотреть сообщение
pawn Код:
new monsters[10];
    monsters[0] = CreateVehicle(444,-1478.7618,943.6302,1041.3199,66.6085,0,196,124);
    monsters[1] = CreateVehicle(444,-1469.9274,939.5936,1041.3219,73.5877,0,196,124);
    monsters[2] = CreateVehicle(444,-1461.8712,936.9880,1041.3203,75.5558,0,196,124);
    monsters[3] = CreateVehicle(444,-1452.4550,934.3753,1041.3235,80.0687,0,196,124);
    monsters[4] = CreateVehicle(444,-1442.4575,932.4373,1041.3236,82.2893,0,196,124);
    monsters[5] = CreateVehicle(444,-1432.0989,931.2426,1041.3236,87.0216,0,196,124);
    monsters[6] = CreateVehicle(444,-1423.1830,931.0004,1041.3236,89.1793,0,196,124);
    monsters[7] = CreateVehicle(444,-1412.1241,930.9387,1041.3237,88.6588,0,196,124);
    monsters[8] = CreateVehicle(444,-1401.5637,930.6543,1041.3237,89.9734,0,196,124);
    monsters[9] = CreateVehicle(444,-1388.2822,930.6476,1041.3239,89.9733,0,196,124);
for(new i=0;i <= monsters;i++)
{
    LinkVehicleToInterior(monsters[i], 7);
}
I get this:

PHP код:
C:\DOCUME~1\Tadej\Desktop\SA-MPS~1\GAMEMO~1\New.pwn(2363) : error 033: array must be indexed (variable "monsters")
C:\DOCUME~1\Tadej\Desktop\SA-MPS~1\GAMEMO~1\New.pwn(2382) : error 033: array must be indexed (variable "sandkings")
C:\DOCUME~1\Tadej\Desktop\SA-MPS~1\GAMEMO~1\New.pwn(2401) : error 033: array must be indexed (variable "bangers")
Pawn compiler 3.2.3664              Copyright (c1997-2006ITB CompuPhase
3 Errors

Lines:

PHP код:
for(new i=0;<= monstersi++) 
PHP код:
for(new i=0;<= sandkingsi++) 
PHP код:
for(new i=0;<= bangersi++) 
Reply
#8

It should be:
pawn Код:
for(new i=0;i <= sizeof(monsters); i++)  // OR for(new i=0;i <= sizeof(bangers); i++)
Reply
#9

Quote:
Originally Posted by Rajat_Pawar
Посмотреть сообщение
It should be:
pawn Код:
for(new i=0;i <= sizeof(monsters); i++)  // OR for(new i=0;i <= sizeof(bangers); i++)
Thanks, no errors
Reply
#10

Another problem

When I type /winner [playerid], then it's pop up the game text without a name and winner don't get any score or money.

I have this stock:

PHP код:
stock GetName(playerid)
{
new
name[24];
GetPlayerName(playeridnamesizeof(name));
return 
name;

Code:

PHP код:
CMD:winner(playeridparams[])
{
    new 
string[200];
    new 
targetid;
    if(
gPlayerInfo[playerid][PLAYER_LEVEL] < 1) return SendClientMessage(playeridCOLOR_RED"You are Not Allowed To Use This Command!");
    if(
gPlayerInfo[playerid][PLAYER_JAILED] == 1)return SendClientMessage(playeridCOLOR_RED"ERROR: You Cannot Use Any Command When You're Jailed!");
    if(
sscanf(params"s"targetid)) return SendClientMessage(playeridCOLOR_ORANGE"Usage: /winner [playerid]");
    
format(stringsizeof(string), "~w~Derby event has ~g~FINISHED~W~! Congratz to~g~ %s ~w~, he earned ~g~$30000 cash ~w~and ~g~30 scores!"GetName(targetid));
    
GameTextForAll(string,5000,3);
    
SetPlayerScore(playeridGetPlayerScore(playerid) + 30);
    
GivePlayerMoney(targetid30000);
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)