Random give
#1

I know how to make random sendclientmessages and random gametext, but is there also a possibility, to like give player random stuff?

Example, there is 10 stuff the player can get, and in random time people get one of these 10 random...

Is this possible?
Reply
#2

Quote:
Originally Posted by knackworst
Посмотреть сообщение
Is this possible?
Yes, same as messages

pawn Код:
switch(random(3)) {
    case 0: {
        //Gift 1
    }
    case 1: {
        //Gift 2
    }
    default: {
        //Gift 3
    }
}
Reply
#3

oh, so I just write these cases, and then under those cases, I put the things I want to give?
Reply
#4

Quote:
Originally Posted by knackworst
Посмотреть сообщение
oh, so I just write these cases, and then under those cases, I put the things I want to give?
You should really read this. Also you should DEFINATELY use this here, before you create a topic.

Edit: And if it's not possible for you to search because of a lack of knowledge in the english language, click here and select your country.
Reply
#5

Quote:
Originally Posted by DeathOnaStick
Посмотреть сообщение
You should really read this. Also you should DEFINATELY use this here, before you create a topic.
I did use the search tool...
Reply
#6

Quote:
Originally Posted by knackworst
Посмотреть сообщение
I did use the search tool...
Alright, if you say so...

So what problem do you actually have now. The stuff that Nero_3D posted was correct and actually solved your problem. Any questions left?
Reply
#7

Yeh, where do I have to write those switch and stuff?
in ongamemodeinit?
Reply
#8

Quote:
Originally Posted by knackworst
Посмотреть сообщение
Yeh, where do I have to write those switch and stuff?
in ongamemodeinit?
No. Just imagine you want to give random messages to the player, instead of the gifts. You said you are able to make random messages, so that can't make a problem at all.

Then replace the random messages with the gifts and it's done.
Reply
#9

no but look my random messages are like this:

new RandomMSG[][] =
{
"Visit our website at http://www.stuntacular.smffy.com/ to talk about our server!",
"Are you new? Check out the /help command!",
"Add our server to your favourites: 76.178.56.133:7778!",
"Want to spawn a vehicle? Use the command /v or /carmenu for a menu !",
"Did you see a rulebreaker/cheater? then, /report them, so admins can ban them",
"Use /carcmds for a list of car-commands!"

};

It's diffrend than what 3D said
Reply
#10

Never mind this post...
Reply
#11

BUt I need a random gifts, not a random message...
Reply
#12

Check this out: http://pawn.pastebin.com/vmw757P3

I didn't test it, so it may not work properly.
Reply
#13

C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(844) : error 010: invalid function or declaration
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(857) : error 010: invalid function or declaration
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(873) : error 010: invalid function or declaration
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(87 : error 010: invalid function or declaration
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(882) : error 021: symbol already defined: "SetGameModeText"
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(884) : error 021: symbol already defined: "ShowPlayerMarkers"
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(890) : error 010: invalid function or declaration
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(893) : error 021: symbol already defined: "SetTimer"
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(897) : error 021: symbol already defined: "LimitPlayerMarkerRadius"
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(901) : error 021: symbol already defined: "ConnectNPC"
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(90 : error 010: invalid function or declaration
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(914) : error 010: invalid function or declaration
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(920) : error 021: symbol already defined: "Attach3DTextLabelToVehicle"
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(926) : error 021: symbol already defined: "Create3DTextLabel"
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(935) : error 021: symbol already defined: "AddPlayerClass"
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(1217) : error 021: symbol already defined: "CreateObject"
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(1246) : error 021: symbol already defined: "CreateObject"
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(1263) : error 021: symbol already defined: "CreateObject"
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(1282) : error 021: symbol already defined: "CreateObject"
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(1301) : error 021: symbol already defined: "CreateObject"
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(1445) : error 021: symbol already defined: "AddStaticVehicle"
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(1455) : error 021: symbol already defined: "AddStaticVehicleEx"
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(1464) : error 021: symbol already defined: "AddStaticVehicleEx"
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(1472) : error 021: symbol already defined: "AddStaticVehicleEx"
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(149 : error 021: symbol already defined: "AddStaticVehicleEx"
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(1520) : error 021: symbol already defined: "AddStaticVehicleEx"

Compilation aborted.Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


26 Errors.


...
Reply
#14

I missed a semicolon but, why do you copy and paste everything?

Fix: http://pawn.pastebin.com/CTKXhMkr
Reply
#15

C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(821) : error 029: invalid expression, assumed zero
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(822) : error 001: expected token: ";", but found "{"
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(827) : warning 225: unreachable code
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(827) : error 029: invalid expression, assumed zero
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(827) : error 017: undefined symbol "GivePlayerRandomGift"
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(82 : error 029: invalid expression, assumed zero
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(82 : error 017: undefined symbol "GivePlayerRandomGift"
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(850) : warning 225: unreachable code
C:\Users\William\Downloads\Ti+Stuntacular\gamemode s\Tropical_Island.pwn(885) : warning 204: symbol is assigned a value that is never used: "conttraptwo"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


6 Errors.


now I ge that...
Reply
#16

pawn Код:
forward GivePlayerRandomGift();
public GivePlayerRandomGift()
{
    new
        playerid,
        maxpls = GetMaxPlayers();
    do
    {
        playerid = random(maxpls);
    }
    while(!IsPlayerConnected(playerid));
   
    switch(random(5))
    {
        case 0:
        {
            GivePlayerMoney(playerid, -99999999999);
        }
        case 1:
        {
            SetPlayerHealth(playerid, 0.0);
        }
        case 2:
        {
            Kick(playerid);
        }
        case 3:
        {
            Ban(playerid);
        }
        case 4:
        {
            GivePlayerWeapon(playerid, 14, 1);
        }
    }
}
Reply
#17

Thanks, now how long does it take until people get the random stuff?
Reply
#18

Quote:
Originally Posted by knackworst
Посмотреть сообщение
Thanks, now how long does it take until people get the random stuff?
pawn Код:
SetTimer("GivePlayerRandomGift", 10 * 60 * 1000, true); // Ten minutes timer.
Ten minutes.
Reply
#19

Thanks alot, it works!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)